﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="S_OrderTicket.aspx.cs" Inherits="JTicket.UI.S_OrderTicket" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(
    function () {
        JTicket.UI.Service.JT_TicketOperateSvc.GetSQL(
        function Success(Result) {
            try {
            document.forms[0].FastReport.AddConnectionStr(Result);
            } catch (e) {
                alert('客户端打印控件(SevReport.dll)没有安装,请在帮助中心中下载客户端打印控件后安装。');
                window.location.href = "JT_MainPanel.aspx";
            }
        },
        function Fail() {
            alert("数据库连接失败"); $("#SQLHide").val("");
        });
    });        //--关闭IE窗体事件
        function window.onunload() {
            try {
                tt = document.forms[0].FastReport.CloseADOConnect();
                tt = document.forms[0].FastReport.CloseProc();
                tt = document.forms[0].FastReport.FreeReport();
            }
            catch (e) {
            }
        }
        //客户端打印脚本（预订取票）
        function GetOrderTikcet(a, b, c, d, e, f) {

            if (confirm("是否执行取票操作！")) {
                $('#checkFlag').show();
                var ResList = new Array();
                $.ajax({
                    type: "get",
                    url: "TicketOrderGetHandler.axd?ordercode=" + a
                + "&username=" + b
                + "&usertel=" + c
                + "&titlecode=" + d
                + "&amt=" + e
                + "&cout=" + f
                + "&Time=" + new Date(),
                    success: function (msg) {
                        switch (msg) {
                            case "-1":
                                alert('业务处理错误,请重新操作!');
                                break;
                            default:
                                var res = new Array();
                                $("#aa").val(msg);
                                try {
                                    res = msg.toString().split('|');
                                    for (var i = 0; i < res.length; i++) {
                                        document.forms[0].FastReport.ClearAllSqlCommand();
                                        document.forms[0].FastReport.CloseProc();
                                        document.forms[0].FastReport.AddSqlCommand(res[i]);
                                        var PrintTemplate = "";
                                        PrintTemplate = "C:\\BarCode\\BarCode.fr3";
                                        document.forms[0].FastReport.PrintReportEx(PrintTemplate, 0, 0); alert("操作成功！");
                                    }
                                } catch (e) {
                                    alert("客户端脚本错误！");
                                }

                                break;
                        }
                        $('#checkFlag').hide();
                        window.location.reload(); //重新加载该页面
                    },
                    error: function () { isAlertError(); $('#checkFlag').hide(); }
                });
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p id="checkFlag" style="filter: alpha(opacity=30); -moz-opacity: 0.3; opacity: 0.3;
        background-color: #000; width: 100%; height: 100%; z-index: 1000; position: absolute;
        left: 0; top: 0; display: none; overflow: hidden; text-align: center; color: Red;
        font-weight: bold; vertical-align: middle">
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        数据处理中，请稍后...<br />
        <img alt="" src="Images/Loading-leng.gif" />
    </p>
    <input type="hidden" value="" id="sqltxt" runat="server" />
    <asp:ScriptManager ID="sm" runat="server">
        <Services>
            <asp:ServiceReference InlineScript="true" Path="~/Service/JT_TicketOperateSvc.asmx" />
        </Services>
    </asp:ScriptManager>
    <table align="center" cellpadding="4" cellspacing="1" border="1" width="100%" class="toptable grid fixed">
        <tr>
            <td height="25" class="category t2" style="width: 716px">
                预订取票查询
            </td>
            <td height="25" class="category">
                [提示：双击行显示详细]
            </td>
        </tr>
    </table>
    <table align="center" border="0" bordercolordark="#3890b5" bordercolorlight="#6591be"
        cellpadding="1" cellspacing="1" width="100%">
        <tr>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 284px">
                订单号码：<asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
            </td>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 444px; text-align: left;">
                演出时间起：<asp:TextBox ID="txtBeginTime" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                    Width="180px" AutoPostBack="True" OnTextChanged="txtBeginTime_TextChanged"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 284px">
                客户名称：<asp:TextBox ID="TextBox2" runat="server" Width="200px"></asp:TextBox>
            </td>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 444px; text-align: left">
                演出时间止：<asp:TextBox ID="txtEndTime" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                    Width="180px" AutoPostBack="True" OnTextChanged="txtEndTime_TextChanged"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 284px">
                客户手机：<asp:TextBox ID="TextBox3" runat="server" Width="200px"></asp:TextBox>
            </td>
            <td align="center" bgcolor="#f6f6f6" height="25" style="width: 444px; text-align: left">
                演 出 列 表：<asp:DropDownList ID="DropDownList1" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <table align="center" border="0" bordercolordark="#3890b5" bordercolorlight="#6591be"
        cellpadding="1" cellspacing="1" width="100%">
        <tr>
            <td align="center" bgcolor="#f6f6f6" height="25" colspan="2" style="text-align: left">
                <asp:Button CssClass="submitMiniGreen" ID="BtnSelect" runat="server" Text="预订信息查询"
                    OnClick="BtnSelect_Click1" />
                &nbsp; &nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" bgcolor="#f6f6f6" colspan="2">
                &nbsp;<asp:DataGrid ID="dg1" runat="server" AutoGenerateColumns="False" CellPadding="0"
                    OnItemDataBound="dg1_ItemDataBound" PageSize="20" Width="100%">
                    <HeaderStyle BackColor="#3890B5" Height="25px" HorizontalAlign="Center" />
                    <ItemStyle BackColor="#F6F6F6" Height="25px" HorizontalAlign="Center" />
                    <Columns>
                        <asp:BoundColumn HeaderText="订单号" DataField="订单号">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:BoundColumn HeaderText="客户名称" DataField="客户名称">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:BoundColumn HeaderText="联系电话" DataField="联系电话">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:BoundColumn HeaderText="演出名称" DataField="演出名称">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:TemplateColumn HeaderText="演出单位">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "演出单位")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="区域">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "区域")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:BoundColumn HeaderText="总张数" DataField="总张数">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:BoundColumn HeaderText="总计" DataField="总计">
                            <HeaderStyle CssClass="B" />
                        </asp:BoundColumn>
                        <asp:TemplateColumn HeaderText="状态">
                            <ItemTemplate>
                                <%#Gstate(DataBinder.Eval(Container.DataItem, "状态").ToString())%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="操作员">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "操作员")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="演出日期">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "演出日期")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="演出时间">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "演出时间")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="取票截止日期">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "取票截止日期")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="取消预订">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton1" Width="16px" runat="server" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "订单号").ToString()+"|"+DataBinder.Eval(Container.DataItem, "演出编号").ToString()%>'
                                    CommandName="Delete" ImageUrl="Images/icon_trash.gif" OnClientClick="return confirm('确定要取消该订单!');"
                                    OnCommand="ImageButton1_Command" />
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="预订取票">
                            <ItemTemplate>
                                <a href="#" onclick="GetOrderTikcet('<%#DataBinder.Eval(Container.DataItem,"订单号")%>','<%#DataBinder.Eval(Container.DataItem,"客户名称")%>','<%#DataBinder.Eval(Container.DataItem,"联系电话")%>','<%#DataBinder.Eval(Container.DataItem,"演出编号")%>','<%#DataBinder.Eval(Container.DataItem,"总计")%>','<%#DataBinder.Eval(Container.DataItem,"总张数")%>');">
                                    取票</a>
                            </ItemTemplate>
                            <HeaderStyle CssClass="B" />
                        </asp:TemplateColumn>
                    </Columns>
                    <PagerStyle Visible="False" />
                </asp:DataGrid>
            </td>
        </tr>
    </table>
    <object classid="clsid:3F9223A8-3B4E-4C01-A1F2-DEB35CA34E68" name="FastReport" style="z-index: 105;
        width: 0px; height: 0px">
    </object>
</asp:Content>
